﻿using System.Windows;
using System.Windows.Input;
using Microsoft.Practices.Unity;
using TrackIT.Common;
using TrackIT.Common.ViewModel;

namespace TrackIT
{
    /// <summary>
    /// Interaction logic for Report.xaml
    /// </summary>
    public partial class ReportWindow : Window
    {
        private ReportViewModel _reportViewModel;

        public ReportWindow()
        {
            _reportViewModel = TrackITContainer.Current.Resolve<ReportViewModel>();
            InitializeComponent();
        }

        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);

            this.DragMove();
        }

        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            switch( e.Key )
            { 
                case Key.Escape:  
                    this.Hide();
                    break;                
            }
        }

        private void Window_Initialized(object sender, System.EventArgs e)
        {
            DataContext = _reportViewModel;
        }
    }
}
